#!/bin/bash

set -ux

echo '部署'
kubectl apply -f nginx.yaml

echo '开放端口'
firewall-cmd --zone=public --add-port=31080/tcp --permanent
firewall-cmd --reload

echo '查询命名空间'
kubectl get namespaces

echo '查看命名空间'
kubectl describe namespace default

# echo '删除命名空间nginx'
# kubectl delete namespaces nginx

echo '查看命名空间发布deployment'
kubectl get deployment

echo '查询命名空间nginx下的发布deployment'
kubectl describe deployment nginx-deployment1

# echo '删除命名空间nginx下的发布deployment'
# kubectl delete deployment nginx-deployment1

echo '查询nginx命名空间下的pods'
kubectl get pods

echo '查询命名空间nginx下的发布pod详情'
# kubectl describe pod nginx-deployment1-6cb86fb6b7-kkpbw

# echo '删除一个deployment的pod节点'
# kubectl delete pod  nginx-deployment1-6cb86fb6b7-txkkj

echo '查询服务列表'
kubectl get services

echo '查询服务详情'
kubectl describe service nginx-service1

# echo '删除一个service服务'
# kubectl delete services nginx-service1
